﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Popups;

namespace Enough.Lifecycle.Common
{
    public class UIRelayCommand : RelayCommand<UIRelayCommand>, IUICommand
    {
        public object Id { get; set; }

        public UICommandInvokedHandler Invoked { get; set; }

        public string Label { get; set; }

        public object DataContext { get; set; }

        public UIRelayCommand(Action<UIRelayCommand> invokeAction, string label, object dataContext = null) : base(invokeAction)
        {
            Id = (new Guid()).ToString();
            Label = label;
            Invoked += invokeExecuteAction;
            DataContext = dataContext;
        }

        private void invokeExecuteAction(IUICommand command)
        {
            Execute(this);
        }
    }
}